﻿@model GitCandy.Models.CompareModel

@{
    ViewBag.Title = String.Format(SR.Shared_TitleFormat, String.Format(SR.Repository_CompareTitle, Model.Name));
}

<h4>
    @await Html.PartialAsync("_RepositoryLink", Model)
</h4>

<div class="row">
    <div class="col-md-3 branch-from">
        @await Html.PartialAsync("_BranchSelector", Model.BaseBranchSelector)
    </div>
    <div class="col-md-3 branch-to">
        @await Html.PartialAsync("_BranchSelector", Model.CompareBranchSelector)
    </div>
    <div class="col-md-1">
        <button class="branch-compare btn btn-primary">@SR.Repository_Compare</button>
    </div>
</div>

@if (Model.Walks == null || Model.Walks.Length == 0)
{
    @SR.Repository_CompareNothing
}
else
{
    <div class="border-area table-responsive">
        <table class="table table-hover">
            <tbody>
                @foreach (var commit in Model.Walks)
                {
                    <tr>
                        <td><span title="@commit.Committer">@commit.Committer.Name.ShortString(20)</span></td>
                        <td><span title="@commit.Committer.When">@commit.Committer.When.LocalDateTime.ToFullString()</span></td>
                        <td>@Html.ActionLink(commit.CommitMessageShort.ShortString(80), "Commit", Html.OverRoute(new { path = commit.Sha }))</td>
                    </tr>
                }
            </tbody>
        </table>
    </div>

    @await Html.PartialAsync("_Diff", Model.CompareResult)
}
